package no.ntnu.idi.deid.documentunits;

import java.util.ArrayList;
import java.util.List;

import no.ntnu.idi.deid.searchresultunits.CategoryTag;
import no.ntnu.idi.deid.searchresultunits.Tag;


public class Phrase extends ArrayList<Token> {

	
	private static final long serialVersionUID = 1L;
	private CategoryTag categoryTag;
	
	/**
	 * Creates a new <code>Phrase</code> instance
	 * @param tokens The list of tokens to be added
	 * @param tag The <code>CategoryTag</code> of the phrase
	 */
	public Phrase(List<Token> tokens, CategoryTag tag) {
		super(tokens);
		categoryTag = tag;
	}
	
	/**
	 * ArrayList default constructor
	 */
	public Phrase() {
	}
		
	public CategoryTag getCategoryTag() {
		return categoryTag;
	}

	public void setCategoryTag(CategoryTag categoryTag) {
		this.categoryTag = categoryTag;
	}
	
	public void setCategoryTag(Tag tag) {
		categoryTag = new CategoryTag(tag);
	}
	
	public void setFinalTagsOnTokens() {
		for(Token t : this) {
			t.setFinalTag(getCategoryTag());
		}
	}
	

	
	
}
